import { defineStore } from 'pinia';
import { supplierQuerySupplierInfo } from '@/genapi/supplier'
import { messageCount } from '@/genapi/_delivery';

export const useSupplierStore = defineStore('menu', () => {

  const supplierInfo = ref({})
  const billInfo = ref({})
  const notifyNum = ref(0)
  const waitSend = ref(false)

  async function getSupplierInfo() {
    const { data } = await supplierQuerySupplierInfo({})
    if (data?.code !== 200) return
    supplierInfo.value = data.data.supplierInfo
    billInfo.value = data.data.billInfo
  }
  function setWaitSend(boo) {
    waitSend.value = boo
  }

  async function getMessageCount() {
    const { data } = await messageCount({})
    if (data?.code !== 200) return
    notifyNum.value = data.data
  }
  return { supplierInfo, getSupplierInfo, billInfo, notifyNum, getMessageCount, waitSend, setWaitSend }
})

